#!/usr/bin/env python
#-*-conding:utf-8-*-

import requests # 发送http请求

path = 'C:/Users/Administrator/Desktop/tmp'

headers = {
	'user-agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.26 Safari/537.36 Core/1.63.6788.400 QQBrowser/10.3.2864.400',
	'Referer':''
}

# 下载audio 音频
def download_audio(audio_url, path, headers):
	audio = requests.get(audio_url,  headers=headers, timeout=60)
	name = path+'/'+audio_url.split('/')[-1]
	with open(name, 'ab') as f:
		f.write(audio.content.decode('gbk','utf8'))

# åå°å¯ãèå°å¤ - éä½èæ
# \xe5\x8d\x95\xe5\xb0\x8f\xe5\xaf\x92\xe3\x80\x81\xe8\x90\x8c\xe5\xb0\x8f\xe5\xa4\x95 - \xe9\x94\x99\xe4\xbd\x8d\xe8\x8a\x82\xe6\x8b\x8d
download_audio('http://127.0.0.1/test/css/\xe5\x8d\x95\xe5\xb0\x8f\xe5\xaf\x92\xe3\x80\x81\xe8\x90\x8c\xe5\xb0\x8f\xe5\xa4\x95 - \xe9\x94\x99\xe4\xbd\x8d\xe8\x8a\x82\xe6\x8b\x8d.mp3', path, headers)